// app.js
App({
  onLaunch() {
    // 展示本地存储能力
    // const logs = wx.getStorageSync('logs') || []
    // logs.unshift(Date.now())
    // wx.setStorageSync('logs', logs)

    //设置导航栏
    //获取菜单按钮的布局位置信息
    let menuButtonObject = wx.getMenuButtonBoundingClientRect();
    //获取系统信息
    wx.getSystemInfo({
      success: res => {

        //状态栏的高度
        let statusBarHeight = res.statusBarHeight,
          //胶囊按钮与顶部的距离
          navTop = menuButtonObject.top,
          navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2;
        let globalData = this.globalData;
        globalData.statusBarHeight = statusBarHeight;
        globalData.navHeight = navHeight; //导航栏高度
        globalData.navTop = navTop; //胶囊按钮与顶部的距离
        globalData.jnheight = menuButtonObject.height; //胶囊的高度
        globalData.jnwidth = menuButtonObject.width; //胶囊的宽度
        globalData.screenHeight = res.screenHeight; //屏幕高度

        globalData.pixelRatio = res.pixelRatio;
      },
      fail(err) {
        console.log(err);
      }
    });
  },
  globalData: {
    openid: '',
    userInfo: null,
    token: "",
    xtoken: "",
    statusBarHeight: 0,
    navHeight: 0,
    navTop: 0,
    jnheight: 0,
    jnwidth: 0,
    screenHeight: 0,
    pixelRatio: 2
  }
})